package com.hitqz.robot.biz.socket;

import java.io.DataOutputStream;
import java.io.IOException;
import java.net.Socket;

/**
 * @author xupkun
 * @date 2024/6/12
 */
public class PowerSocketTest {

    public static void main(String[] args) throws IOException {
        String ip = ""; int port = 10000;

        Socket socket = new Socket(ip, port);


        byte[] allStatus = new byte[]{
                (byte) 0xFE, 0x01, 0x00,0x00, 0x00, 0x04, 0x29, (byte) 0xC6
        };
        byte[] open1 = new byte[] {
                (byte) 0xFE, 0x05, 0x00,0x00, (byte) 0xFF, 0x00, (byte) 0x98, (byte) 0x35
        };

        // close 1 FE 05 00 00 00 00 D9 C5

        byte[] open2 = new byte[] {
                (byte) 0xFE, 0x05, 0x00,0x01, (byte) 0xFF, 0x00, (byte) 0xC9, (byte) 0xC5
        };

        // close2 FE 05 00 01 00 00 88 05


        //FE 05 00 03 FF 00 68 35
        byte[] open3 = new byte[] {
                (byte) 0xFE, 0x05, 0x00,0x02, (byte) 0xFF, 0x00, (byte) 0x39, (byte) 0xF5
        };
        // close3 FE 05 00 02 00 00 78 05

        byte[] open4 = new byte[] {
                (byte) 0xFE, 0x05, 0x00,0x03, (byte) 0xFF, 0x00, (byte) 0x68, (byte) 0x35
        };

        // close4 FE 05 00 03 00 00 29 C5


        socket.setSoTimeout(60000);
        DataOutputStream out = new DataOutputStream(socket.getOutputStream());

        out.write(open1);

        out.close();
        socket.close();



    }

}
